<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Kontraktor_mdl extends CI_Model{
    function __construct(){
        parent::__construct();
        $this->load->database();
    }

	function getListKontraktor(){
		$query=$this->db->query("SELECT * FROM t_kontraktor");
		if ($query->num_rows()>0){
			$data = array();
			$i=0;
			foreach ($query->result_array() AS $row){
				
				$row["id_kontraktor"];
				$row["nama"];
				$row["alamat"];
				$row["telp_rmh"];
				$row["hp"];
				$row["e_mail"];
				$row["dt_stamp"];
				$row["update_id"];
				
				$data[$i] = $row;
				$i++;
			}
			return $data;
				
		}
	
	}
	
    public function SaveAdd($data){
		$this->db->insert('t_kontraktor',$data);
	}
	
	public function SaveEdit($data){
		$this->db->where('id_kontraktor',$this->input->post('id_kontraktor'));
		$this->db->update('t_kontraktor',$data);
	} 
	
	public function Delete($id){
	    $this->db->where('id_kontraktor','003');
		$this->db->delete('t_kontraktor'); 	
	}
	
}	
?>